<?php
/**
 * User: lie
 * Date: 2020-11-05 21:17
 * description:
 */
    echo "<form action='' method='post'>";
    echo "测试口令:  <input type='text' name='text'>";
    echo "<input type='submit' name='sub'>";
    echo "</form>";
    define("PI", 3.1415926);
    function Encrypt($str){
        return $str = $str + PI;
    }

    function Decrypt($str){
        return $str = $str - PI;
    }
    if ($_POST['sub']){
        echo "加密口令: ".Encrypt($_POST['text']);
        echo "<br>";
        $_SESSION['pwd'] = Encrypt($_POST['text']);

    ?>
<?php
    }
    echo "<a href='052.php?pwd'>解密口令</a>";
    echo "<br>";
    if (isset($_GET['pwd'])){
        echo "解密口令: ".Decrypt($_SESSION['pwd']);
        echo "<br>";
    }
?>
